package z_painter;
import java.awt.Frame;
import java.awt.Dialog;
import java.awt.TextField;
import java.awt.Rectangle;
import java.awt.Button;
import java.awt.event.*;
public class MyDialog extends Dialog implements ActionListener{

	private static final long serialVersionUID = 1L;
	private TextField weight = null;
	private Button okBtn = null;
	MyPainter mp=null;
	
	/**
	 * @param owner
	 */
	public MyDialog(Frame owner) {
		super(owner);
		initialize();
		mp = (MyPainter)owner;
		this.setVisible(true);
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setTitle("선의 굵기");
		this.setLayout(null);
		this.setSize(300, 200);
		this.add(getWeight(), null);
		this.add(getOkBtn(), null);
	}

	/**
	 * This method initializes weight	
	 * 	
	 * @return java.awt.TextField	
	 */
	private TextField getWeight() {
		if (weight == null) {
			weight = new TextField();
			weight.setBounds(new Rectangle(70, 51, 152, 38));
		}
		return weight;
	}

	/**
	 * This method initializes okBtn	
	 * 	
	 * @return java.awt.Button	
	 */
	private Button getOkBtn() {
		if (okBtn == null) {
			okBtn = new Button("OK");
			okBtn.setBounds(new Rectangle(72, 103, 146, 36));
			okBtn.addActionListener(this);
		}
		return okBtn;
	}

	public void actionPerformed(java.awt.event.ActionEvent e) {
		mp.weight = Integer.parseInt(weight.getText());
		mp.stroke();
		this.dispose();
	}

	
}  //  @jve:decl-index=0:visual-constraint="237,25"
